<?php
header('Content-Type:text/html; Charset=UTF-8');
require 'lib/checker.php';
require 'lib/db.php';
@$desks = dbSelectAll('select id,name from desk order by id asc');
require 'lib/header.php';
?>
		<div class="container">
			<div class="row">
				<div class="col-xs-2">
                     <a href="boardAdd.php" class="btn btn-primary btn-block">添加餐桌</a>
                     <a href="main.php" class="btn btn-primary btn-block">返回首页</a>
				</div>
				<div class="col-xs-5">
					<div class="panel panel-primary">
						<div class="panel-heading">
                            <div class="panel-title">
                                <span class="glyphicon glyphicon-th-list"></span> 餐桌列表<span class="col-md-offset-8"></span>
                            </div>
                        </div>
                        <div class="panel-body">
                        	<div class="list-group">
                        		<table class="table table-striped table-bordered table-hover text-center">
                        			<tr>
                        				<td>序号</td>
					                    <td>餐桌名称</td>
					                    <td>当前菜品</td>
					                    <td>操作方式</td>
					                </tr>
					                <?php foreach ($desks as $desk){?>
						                <tr>
						                	<td><?php echo $desk['id']; ?></td>
						                    <td><?php echo $desk['name'];?></td>
						                    <td><a href="#">查看</a></td>
						                    <td>
						                        <a href="boardEdit.php?id=<?php echo $desk['id']?>">编辑</a>|
						                        <a href="#delete<?php echo $desk['id']?>" data-toggle="modal">删除</a>
						                        <div class="modal fade" id="delete<?php echo $desk['id']?>" tabindex="-1" >
						                        	<div class="modal-dialog">
						                        		<div class="modal-content">
						                        			<div class="modal-header">
						                        				<button type="button" class="close" data-dismiss="modal">
						                        					<span>&times;</span><span class="sr-only">Close</span>
						                        				</button>
						                        				<h4 class="modal-title">确定删除<?php echo $desk['name']?></h4>
						                        			</div>
						                        			<div class="modal-body">
						                        			     你确定要删除餐桌<?php echo $desk['name']?>吗？
						                        			</div>
						                        			<div class="modal-footer">
						                        				<a type="button" class="btn btn-default" href="boardDelete.php?id=<?php echo $desk['id']?>">确定</a>
						                        				<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
						                        			</div>
						                        		</div>
						                        	</div>
						                        </div>
						                    </td>
						                </tr>
			                    	<?php } ?>
                        		</table>
                        	</div>
                        </div>
					</div>
				</div>
			</div>
		</div>
   </body>
</html>